Skip to content

feat: formal-synthesis paper gap closure — knowledge router, consensus verify, radar, ledger sync, deja, dash v2#67

Merged
CodeWithJuber merged 2 commits into
masterfrom
claude/research-paper-implementation-va5g2u
Jul 17, 2026
Merged

feat: formal-synthesis paper gap closure — knowledge router, consensus verify, radar, ledger sync, deja, dash v2#67
CodeWithJuber merged 2 commits into
masterfrom
claude/research-paper-implementation-va5g2u

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

What & why

Closes the verified gaps between the newest research paper (research/formal-synthesis/ — "A Formal Theory of the Cognitive Substrate for Coding Agents") and what src/ actually implements, plus the two priority tracks: UI/UX and cross-session memory.

Landed so far (more commits arriving — this PR is being built incrementally by a multi-agent workflow):

  • docs(research): crosswalk bindings reconciled with the real cortex-hook system (stale docs-guard.sh/session-context.sh/intent-router.sh references replaced) + a new crosswalk docs-check reconciler that fails CI when a crosswalk binding names a file that doesn't exist.
  • feat(fmt): zero-dep color-aware CLI formatting (src/fmt.js — FORCE_COLOR > NO_COLOR > TTY precedence, brand-token painting, aligned tables, confidence bars) adopted in ledger/cortex/route/doctor/cost.

Queued in this PR (one conventional commit each):

  • feat(know): A7 knowledge-router — total route(fact) → storage home (paper Theorem T6)
  • feat(precommit): commit-level gate rung — the paper's missing middle of the turn ⊂ commit ⊂ PR gate lattice
  • feat(update): --to <version> pin/downgrade
  • feat(verify): multi-lens consensus (noisy-OR + cross-family gate, Theorem-D residual reporting)
  • feat(radar): dependency-currency rings computed from evidence (paper invariant I4), recorded as ledger claims
  • feat(ledger): sync — CRDT push/pull over a git ref or directory, --personal recall portability
  • feat(deja): session summary claims + similar-task lookup — anti-repetition across sessions/machines
  • feat(dash): v2 — live refresh, history trends, radar/memory/gate/timeline panels
  • feat(report): self-contained HTML report emit
  • chore(hooks): web session-start install hook + final docs sweep

Checklist

  • npm test passes (727 tests at current tip)
  • npm run check passes (Biome — 6 pre-existing warnings unchanged)
  • New public functions have a test
  • Conventional commit message (feat:/fix:/docs: …)
  • CHANGELOG.md updated under ## [Unreleased]
  • No new runtime dependency (dev deps ok)
  • Substrate/docs updated if this changes forge substrate, forge impact, router/gate, or MCP substrate tools

Risk & rollback

  • Risk level: medium (new commands and hook advisories are additive; all advisories fail-open; network features are cache-first with offline degradation)
  • Rollback plan: revert the merge commit; every feature also has a kill switch (FORGE_COMMIT_GATE=0, FORGE_RADAR=0, FORGE_DEJA=0) and no ledger schema changes were made (no new ORACLES/KINDS rows), so cross-version ledger merges stay clean.

Extra checks (tick if applicable)

  • npm run typecheck passes
  • Input validated at boundaries; errors handled (no swallowing)
  • Authorization/ownership checked (if it touches access)
  • Logs contain no secrets/PII
  • If AI-assisted: I understand it, verified the package APIs, and it has tests

🤖 Generated with Claude Code

https://claude.ai/code/session_017Ebv4QDTqzPzgApBW2KUsU


Generated by Claude Code

claude added 2 commits July 17, 2026 02:45
The formal-synthesis crosswalk (rows 5/6/12/14) and its README §11 binding
paragraph cited hooks this repo no longer ships (docs-guard.sh,
session-context.sh, intent-router.sh). Rewritten to the real bindings —
cortex.sh -> src/gate.js stopGate (Stop), src/session.js rehydrationBlock
(SessionStart), src/intent.js exemplar k-NN (UserPromptSubmit) — with
kit-only names marked by a kit: prefix so the claude-e2e-kit binding stays
distinguishable from forgekit's.

New checkCrosswalk reconciler in src/docs_check.js (registered as the
"crosswalk" dimension): every non-kit: .js/.sh file token in
crosswalk.json's forgekit column must exist in src/, global/guards/, or
hooks/; corrupt JSON errors, a missing crosswalk.json (npm installs
without research/) is a no-op. ARCHITECTURE.md docs-check paragraph and
CHANGELOG [Unreleased] updated in the same change; tests cover pass,
stale-binding, kit:-optout, corrupt, and missing cases.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017Ebv4QDTqzPzgApBW2KUsU
… in ledger/route/doctor/cost

New src/fmt.js (zero runtime deps): supportsColor with the standard
FORCE_COLOR > NO_COLOR > TERM=dumb > isTTY precedence, paint(text, role)
mapping semantic roles (ok/warn/err/accent/dim) to brand.json dark-palette
tokens — 24-bit SGR when COLORTERM declares truecolor, portable 16-color
fallback otherwise (the statusline.sh degradation pattern) — plus a
visible-width-aware table() and a bar(v01) confidence meter. With color
off, paint is the identity, so piped output never carries an escape byte.

Adopted in cli.js: doctor status icons + verdict, ledger stats val triage,
ledger blame val meter + confirm/contradict evidence, ledger query score
meters, cortex confidence meters, route model pick + complexity meter,
cost footnotes, and the --verbose title line. All four terminal env reads
(NO_COLOR, FORCE_COLOR, TERM, COLORTERM) are registered with
docs_check.envVarsRead and documented in README.md + docs/GUIDE.md.

Tests: test/fmt.test.js covers the precedence table, truecolor hex
emission from brand.json, bar clamping, ANSI-aware table alignment, and
an end-to-end CLI spawn proving FORCE_COLOR=1 colors piped output while
NO_COLOR strips it.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017Ebv4QDTqzPzgApBW2KUsU
@CodeWithJuber
CodeWithJuber marked this pull request as ready for review July 17, 2026 03:04
@CodeWithJuber
CodeWithJuber merged commit ef30ee2 into master Jul 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants